package com.ruoyi.applet.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Getter
public enum StatusEnum {

    HC("HC", "泓昌"),
    HS("HS", "恒盛"),
    HXR("HXR", "安民"),
    XXR("XXR", "大鸿"),
    YXR("YXR", "余慈"),
    RRL("RRL", "博鸿"),
    BT("BT", "北屯"),
    XH("XH", "鑫会"),
    DD("DD", "宝利典当"),
    HL("HL", "杭联律所"),
    XL("XL", "鑫联"),
            ;

    private String value;
    private String name;

    StatusEnum(String value, String name){
        this.value = value;
        this.name = name;
    }

    public static List<Map<String, Object>> getStatusTypeMapList(){
        List<Map<String, Object>> resultList = new ArrayList<>();
        for (StatusEnum statusEnum : values()) {
            Map<String, Object> itemMap = new HashMap<>();
            itemMap.put("key", statusEnum.getName());
            itemMap.put("value", statusEnum.getValue());
            resultList.add(itemMap);
        }
        return resultList;
    }

    public static String getNameByValue(String statusType) {
        for (StatusEnum statusEnum : values()) {
            if (ObjectUtil.equals(statusType, statusEnum.getValue())){
                return statusEnum.getName();
            }
        }
        return String.valueOf(statusType);
    }

    public static String getValueByName(String value) {
        for (StatusEnum typeEnum : values()) {
            if (ObjectUtil.equals(value, typeEnum.getValue())){
                return typeEnum.getName();
            }
        }
        return String.valueOf(value);
    }



}
